/****************************************************************
 * Homework 6 'Scheduler' class header file
 * Author: Duncan Buell
 * Modified by: Shore, Anderson, Ring, Edwards
 * Date last modified: 5 April 2010
 *
 * Full documentation is in the implementation file.
**/
#ifndef SCHEDULER_H
#define SCHEDULER_H

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

#include "ComparisonFinish.h"
#include "ComparisonStart.h"
#include "Process.h"
#include "Utils.h"

using namespace std;

class Scheduler
{
public:
  Scheduler();
  virtual ~Scheduler();
  void runSimulation(ifstream& inStream); 

private:
  priority_queue<Process, vector<Process>, ComparisonFinish> theReadyQ;
  priority_queue<Process, vector<Process>, ComparisonStart> thePendingQ;
  long pidCounter;
  long maxExecTime;
  void addPending(long pid, long startTime, long execTime);
  bool empty();
  void readyPop();
  void pendingPop();
  Process readyTop();
  Process pendingTop();
  string toStringDumpPendingQ();
  string toStringDumpReadyQ();
  void loadPendingQ(ifstream& inStream);
  void intializePendingQ(ifstream& inStream);
};

#endif /*SCHEDULER_H*/

